Skip to content

Put module-info.class in the jar root instead of a multi-release jar - #128

Merged
pjfanning merged 1 commit into
apache:trunkfrom
pjfanning:jpms-module-info-root
Oct 4, 2026
Merged

pjfanning merged 1 commit into
apache:trunkfrom
pjfanning:jpms-module-info-root

Conversation

@pjfanning

Copy link
Copy Markdown
Member

Now that Java 17 is the minimum, the module descriptor no longer needs to be hidden from Java 8 under META-INF/versions/9 in a multi-release jar. This mirrors apache/poi#1365.

  • module-info.class goes in the jar root and the Multi-Release manifest attribute is dropped.
  • src/main/java9/module-info.java moves to src/main/jpms/module-info.java, and the sources jar now includes it.
  • Gradle: compileJava9 becomes compileModuleInfo, which uses release 17 and the project toolchain instead of its own jdkVersion toolchain. The java9 configuration (the module path, kept separate so the maven plugin dependencies stay off it) is renamed to jpms.
  • Ant: the module-info compile pointed at src/main/multimodule/java9, which no longer exists. It now compiles src/main/jpms into build/classes-jpms and puts the descriptor in the jar root.
  • src/main/java9 also had a Java 9+ MavenPluginResolver based on javax.xml.catalog. It replaces the Java 8 version, which used the JDK-internal com.sun.org.apache.xml.internal.resolver API. Supported JDKs already ran the javax.xml.catalog version, so the maven plugin behaves as before. The com.sun.org.apache.xml.internal:resolver dependency is removed from Gradle, Ant and the bundled plugin POM.
  • animalsniffer ignores javax.xml.catalog.*, which Android lacks. Only the maven plugin uses it.

Checked locally:

  • ./gradlew jar sourcesJar animalsnifferMain forbiddenApisMain passes.
  • The jar has a single root module-info.class (class version 61), no versions/9 entries and no Multi-Release attribute. jar --describe-module reports org.apache.xmlbeans.
  • The Ant build was not run; tests are left to CI.

🤖 Generated with Claude Code

Java 17 is now the minimum, so the module descriptor no longer needs to
be hidden from Java 8 under META-INF/versions/9.

- move src/main/java9/module-info.java to src/main/jpms
- replace compileJava9 with compileModuleInfo (release 17, project
  toolchain) and rename the java9 configuration to jpms
- drop the Multi-Release manifest attribute (Gradle and Ant)
- fix the Ant build, which compiled from the missing
  src/main/multimodule/java9 directory
- the javax.xml.catalog based MavenPluginResolver replaces the Java 8
  one, so the com.sun.org.apache.xml.internal:resolver dependency goes
- ignore javax.xml.catalog in animalsniffer (maven plugin only)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pjfanning
pjfanning merged commit c24e63e into apache:trunk Oct 4, 2026
3 checks passed
@pjfanning
pjfanning deleted the jpms-module-info-root branch October 4, 2026 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant